import request from '../utils/request';

/**
 * 新增项目模块
 * @param {*} data
 */
const create = data => request({
  url: '/v1/project/module',
  method: 'post',
  data
});

/**
 * 根据模块id获取对应模块数据
 * @param {*} id
 */
const getById = id => request({
  url: `/v1/project/module/${id}`,
  method: 'get'
});

/**
 * 修改模块
 * @param {*} data
 */
const modify = data => request({
  url: `/v1/project/module/${data.Id}`,
  method: 'put',
  data
});

/**
 * 获取分页模块数据
 * @param {*} params
 */
const getPage = params => request({
  url: `/v1/project/module/${params.id}/page`,
  method: 'get',
  params
});

/**
 * 更新模块状态
 * @param {*} id
 * @param {*} status
 */
const modifyStatus = (id, status) => request({
  url: `/v1/project/module/${id}/status`,
  method: 'put',
  params: { status }
});

export default {
  getById,
  getPage,
  create,
  modify,
  modifyStatus
}
